package com.cskaoyan.day31.work1._04_proxy._01_static_proxy;

import com.cskaoyan.day31.work1._04_proxy._00_bean.BuyFood;
import com.cskaoyan.day31.work1._04_proxy._00_bean.Study;
import com.cskaoyan.day31.work1._04_proxy._00_bean.User;
import net.sf.cglib.proxy.InvocationHandler;

public class UserProxy4Common implements BuyFood, Study {

    User user = new User();

    InvocationHandler4 invocationHandler4;

    public void setInvocationHandler4(InvocationHandler4 invocationHandler4){
        this.invocationHandler4 = invocationHandler4;
    }
    @Override
    public void buyBreakfast(String name) {
        user.buyBreakfast(name);
        invocationHandler4.invoke();
    }

    @Override
    public void buyLunch(String name) {
        user.buyLunch(name);
        invocationHandler4.invoke();
    }

    @Override
    public void buyDinner(String name) {
        user.buyDinner(name);
        invocationHandler4.invoke();
    }

    @Override
    public String study(String name1, String name2) {
        String study = user.study(name1, name2);
        invocationHandler4.invoke();
        return study;
    }
}
